package juhouse.biz.kc.action;
import java.net.URLDecoder;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import juhouse.biz.kc.dao.InterfaceDao;

public class InterfaceAction extends DispatchAction {

	public ActionForward getJsonBySQL(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		String CONN=request.getParameter("CONN");
		String SQL=request.getParameter("SQL");
		SQL=URLDecoder.decode(SQL, "UTF-8");
		InterfaceDao dao = new InterfaceDao();
		StringBuffer ROWSBuf = dao.getJsonBySQL(CONN,SQL);
		response.setCharacterEncoding("GBK");
		request.setAttribute("validateResult", ROWSBuf.toString());
		return mapping.findForward("validateResult");
	}
	
}
